package cn.dubito.springcloud.service;

import cn.dubito.springcloud.entity.Dept;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * 服务降级处理
 * 就算 宕机 了也要方法信息
 *
 * @author liliang
 * @description:
 * @date 2018/5/21.
 */
@FeignClient(value = "MICROSERVICECLOUD-DEPT", fallbackFactory = DeptClientServiceFallBackFactory.class)
public interface DeptClientService {

    /**
     * 添加
     *
     * @param dept
     * @return
     */
    @PostMapping("/dept/add")
    boolean add(Dept dept);

    /**
     * 查找
     *
     * @param deptNo
     * @return
     */
    @GetMapping("/dept/{deptNo}")
    Dept get(@PathVariable("deptNo") Long deptNo);

    /**
     * 查找全部
     *
     * @return
     */
    @GetMapping("/dept/list")
    List<Dept> list();
}
